<!DOCTYPE html>
<!--suppress ALL-->
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous" />
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
</head>
<body>
<div class="container-fluid" id="app">
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-12 text-center" style="background-color: red; color: white" >
                <h3>蜗牛书店</h3>
            </div>
        </div>

        <div class="row" style="margin-top: 10px">
            <div class="col-md-6">
                <ol class="breadcrumb">
                    <li v-for="bt in typelist"><a :href="'/book/showBookView/?typeid='+bt.id" v-text="bt.name"></a></li>
                </ol>
            </div>

            <div class="col-md-3">
                <form class="form-inline">
                    <div class="form-group">
                        <label for="search" class="sr-only">请输入关键词</label>
                        <input type="text" class="form-control" id="search" placeholder="请输入关键词">
                    </div>
                    <button type="submit" class="btn btn-default">搜索</button>
                </form>
            </div>

            <div class="col-md-3">
                <button type="button" class="btn btn-default btn-sm">个人中心</button>
                <button type="button" class="btn btn-default btn-sm">我的购物车</button>
                <button type="button" class="btn btn-default btn-sm">我的订单</button>
            </div>
        </div>
    </div>

    <div class="container">
        <div class="row">

            <div class="col-md-4">
                <div class="thumbnail">
                    <img th:src="${book.imgsrc}" alt="...">
                </div>
            </div>
            <div class= "col-md-8">
                <p>书名 : <span th:text="${book.name}"></span></p>
                <p>作者 : <span th:text="${book.author}"></span></p>
                <p>出版社 : <span th:text="${book.provider}"></span></p>
                <p>价格 : <span th:text="${book.price}"></span></p>
                <p>简介 : <span th:text="${book.detail}"></span></p>
            </div>
        </div>

        <div class="row">
            <div class="col-md-12">
                <a class="btn btn-primary" href="">加入购物车</a>
            </div>
        </div>
    </div>

    <div class="container">

    </div>
</div>

<script>
    let vueApp = new Vue({
        el:"#app",
        data:{
            typelist:[],
        },
        methods:{
            //初始化图书类型的数据
            initBookType(){
                let _this = this ;
                let url = "../../home/typeList" ;
                $.get(url,function (data){
                    console.log(data);
                    _this.typelist = data ;
                },"json")
            }


        },
        created(){
            this.initBookType();
        }
    });
</script>
</body>
</html>